<!DOCTYPE html>
<html>
  <head>
    	<base href="<%=basePath%>">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title>试题管理</title>
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="keywords" content="">
		<link rel="shortcut icon" href="<%=basePath%>resources/images/favicon.ico" />
		<link href="resources/bootstrap/css/bootstrap-huan.css" rel="stylesheet">
		<link href="resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
		<link href="resources/css/style.css" rel="stylesheet">
		
		<link href="resources/css/exam.css" rel="stylesheet">
		<link href="resources/chart/morris.css" rel="stylesheet">
	</head>
	<body>
		<header>
			<div class="container">
				<div class="row">
					<div class="col-xs-5">
						<div class="logo">
							<h1 style="margin-top: 4px"><a href="#"><img alt="" src="resources/images/logo.png"></a></h1>
						</div>
					</div>
					<div class="col-xs-7" id="login-info">
						<#--<c:choose>
							<c:when test="${not empty sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}">
								<div id="login-info-user">
									
									<a href="user-detail/${sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}" id="system-info-account" target="_blank">${sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}</a>
									<span>|</span>
									<a href="j_spring_security_logout"><i class="fa fa-sign-out"></i> 退出</a>
								</div>
							</c:when>
							<c:otherwise>
								<a class="btn btn-primary" href="user-register">用户注册</a>
								<a class="btn btn-success" href="user-login-page">登录</a>
							</c:otherwise>
						</c:choose>-->
                            <div id="login-info-user">

                    </div>

					</div>
                    <div class="col-xs-7" id="login-info">
                        <a  href="/user/logout" style="font-size: 20px">当前登陆用户:${Curr_User.userName}</a>
                    </div>
				</div>
			</div>
		</header>
		<!-- Navigation bar starts -->

		<div class="navbar bs-docs-nav" role="banner">
			<div class="container">
				<nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
					<ul class="nav navbar-nav">
						<li>
							<a href="/user/home"><i class="fa fa-home"></i>主页</a>
						</li>
						<li>
							<a href="/user/intopractice"><i class="fa fa-edit"></i>试题练习</a>
						</li>
						<li>
							<a href="/user/exam"><i class="fa  fa-paper-plane-o"></i>在线考试</a>
						</li>

						<li>
							<a href="/intousercenter"><i class="fa fa-dashboard"></i>会员中心</a>
						</li>
						<li class="active">
							<a href="/update"><i class="fa fa-cogs"></i>个人设置</a>
						</li>
					</ul>
				</nav>
			</div>
		</div>

		<!-- Navigation bar ends -->

		<!-- Slider starts -->

		<div>
			<!-- Slider (Flex Slider) -->

			<div class="container" style="min-height:500px;">

				<div class="row">
					<div class="col-xs-2">
						<ul class="nav default-sidenav">
							<li>
								<a href="/update"> <i class="fa fa-cogs"></i> 基本资料 </a>
							</li>
							<li class="active">
								<a> <i class="fa fa-wrench"></i> 修改密码 </a>
							</li>

						</ul>

					</div>
					<div class="col-xs-10">
						<div class="page-header">
							<h1><i class="fa fa-wrench"></i> 修改密码 </h1>
						</div>
						<div class="page-content row">
							<form class="form-horizontal" id="form-change-password"  style="margin-top:40px;" method="post">
                                <input type="hidden" id="userId" value="${user.userId}">
									<!-- password -->
									<div class="form-group form-password">
										<label class="control-label col-md-2" for="password">新密码</label>
										<div class="col-md-5">
											<input type="password" class="form-control" id="password">
											<span class="form-message"></span>
										</div>
									</div>
									
									<!-- password-confirm -->
									<div class="form-group form-password-confirm">
										<label class="control-label col-md-2" for="password-confirm">确认新密码</label>
										<div class="col-md-5">
											<input type="password" class="form-control" id="password-confirm">
											<span class="form-message"></span>
										</div>
									</div>

									<!-- Buttons -->
									<div class="form-group">
										<!-- Buttons -->
										<div class="col-md-5 col-md-offset-2">
											<button type="submit" class="btn btn-info" id="btn-reg">
												确认修改
											</button>
										</div>
									</div>
								</form>
							
							
							

						</div>
					</div>
				</div>
			</div>
		</div>

		<footer>
			<div class="container">
				<div class="row">
					<div class="col-md-12">
						<div class="copy">
							<p>
								ExamStack Copyright © <a href="http://www.examstack.com/" target="_blank">ExamStack</a> - <a href="." target="_blank">主页</a> | <a href="http://www.examstack.com/" target="_blank">关于我们</a> | <a href="http://www.examstack.com/" target="_blank">FAQ</a> | <a href="http://www.examstack.com/" target="_blank">联系我们</a>
							</p>
						</div>
					</div>
				</div>

			</div>

		</footer>

		<!-- Slider Ends -->

		<!-- Javascript files -->
		<!-- jQuery -->
		<script type="text/javascript" src="resources/js/jquery/jquery-1.9.0.min.js"></script>
		<script type="text/javascript" src="resources/js/all.js"></script>
		<!-- Bootstrap JS -->
		<script type="text/javascript" src="resources/bootstrap/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="resources/chart/raphael-min.js"></script>
		<script type="text/javascript" src="resources/chart/morris.js"></script>
		<#--<script type="text/javascript" src="resources/js/pwd-change.js"></script>-->
	</body>
</html>
<script>
/*
    var changPwd=function () {
		$.ajax({
            type : 'POST',
            url : 'editPwd',
            data :{
                password:$("#password-confirm").val()
            },
            success: function (data) {
                alert("修改成功!请重新登陆！")

                window.location.href='login.html';
            }
		});
    };
    $("#btn-reg").click(function () {
        $("#msg").html();
        if($("#password").val() == $("#password-confirm").val()){
            changPwd();
        }else {
            $("#msg").html("<span class='glyphicon glyphicon-remove' style='color: red'></span>");
        }
    });*/

$(function(){
    var form = $("#form-change-password");
    form.submit(function(){
        var password = $("#password").val();
        var password_confirm = $("#password-confirm").val();
        if(password != password_confirm){
            $(".form-password-confirm .form-message").text("两次密码不一致！");
            return false;
        }
        if(password.length > 10 || password.length <6){
            $(".form-password .form-message").text("长度请保持在6到10之间！");
            return false;
        }
        $.ajax({
            type : 'POST',
            url : 'editPwd',
            data :{
                password:$("#password-confirm").val()
            },
            success: function (data) {
                alert("修改成功!请重新登陆！")
                window.location.href='login.html';
            }
        });
        return false;
    });
});
</script>